﻿using Rougamo;
using Rougamo.Context;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Scheduler.Common.AOP
{
    public class LoggingAttribute : MoAttribute
    {
        public override void OnEntry(MethodContext context)
        {
            Console.WriteLine($"Entering method {context.Method.Name}");
        }

        public override void OnSuccess(MethodContext context)
        {
            Console.WriteLine($"Method {context.Method.Name} executed successfully");
        }

        public override void OnException(MethodContext context)
        {
            Console.WriteLine($"Method {context.Method.Name} threw an exception: {context.Exception.Message}");
        }

        public override void OnExit(MethodContext context)
        {
            Console.WriteLine($"Exiting method {context.Method.Name}");
        }
    }
}
